package cn.edu.nuc.ssm.dto;

import cn.edu.nuc.ssm.entity.Category;

import java.util.List;

/**
 * Created by Administrator on 2017/4/17.
 */
public class ZhiTypeNameAndmoneyArrDto {

   private ZhiTypeNameAndmoneyDto[] zhiTypeNameAndmoneyDto;


    public ZhiTypeNameAndmoneyArrDto() {
    }

    public ZhiTypeNameAndmoneyArrDto(List<Category> initCategory, List<ZhiTypeNameAndmoneyDto> list){

        int size = initCategory.size();
        zhiTypeNameAndmoneyDto = new ZhiTypeNameAndmoneyDto[size];
        for (int i = 0 ; i < size ; i++){
            zhiTypeNameAndmoneyDto[i]=new ZhiTypeNameAndmoneyDto();
            zhiTypeNameAndmoneyDto[i].setName(initCategory.get(i).getName());
        }
        for(int i = 0 ; i < size ; i++){
            String name = zhiTypeNameAndmoneyDto[i].getName();
            for (int j=0 ; j < list.size() ; j++){
                if (name.equals(list.get(j).getName())){
                    zhiTypeNameAndmoneyDto[i].setMoney(list.get(j).getMoney());
                }
            }
        }

    }

    public ZhiTypeNameAndmoneyDto[] getZhiTypeNameAndmoneyDto() {
        return zhiTypeNameAndmoneyDto;
    }

    public void setZhiTypeNameAndmoneyDto(ZhiTypeNameAndmoneyDto[] zhiTypeNameAndmoneyDto) {
        this.zhiTypeNameAndmoneyDto = zhiTypeNameAndmoneyDto;
    }
}
